home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr42 / vocshow2.zip / VOC_DATA.LIB < prev    next >
Text File  |  1993-06-08  |  2KB  |  65 lines

  1. -- Copyright 1992 by Tom Moran.  May be used by anyone for any purpose.
  2.  
  3. with SB_Samples;
  4.  
  5. package Voc_Data is
  6.  
  7.   Max_Block_Length: constant := 10000; -- arbitrary
  8.  
  9.   subtype Block_Lengths is Integer range 0 .. Max_Block_Length;
  10.   subtype Block_Indices is Integer range 1 .. Max_Block_Length;
  11.  
  12.   type Block_Types is (Terminator, Voice_Data, Voice_Continuation, Silence,
  13.     Marker, Text, Start_Repeat, End_Repeat);
  14.  
  15.   for Block_Types use (Terminator => 0, Voice_Data => 1,
  16.                        Voice_Continuation => 2, Silence => 3,
  17.                        Marker => 4, Text => 5,
  18.                        Start_Repeat => 6, End_Repeat => 7);
  19.   for Block_Types'Size use 8;
  20.  
  21.   subtype Sample_Rates is Natural range 3906 .. Integer'Last;
  22.  
  23.   type Pack_Types is (Unpacked, Halved, Thirds, Quartered);
  24.   for Pack_Types use (Unpacked => 0, Halved => 1, Thirds => 2, Quartered => 3);
  25.  
  26.   subtype Positive_Durations is Duration range 0.0 .. Duration'last;
  27.  
  28.   type Markers is range 1 .. 16#FFFE#;
  29.  
  30.   type Repeat_Counts is range 1 .. 16#FFFF#;
  31.  
  32.   type Blocks(Block_Type: Block_Types := Terminator;
  33.               Packing   : Pack_Types  := Unpacked) is
  34.     record
  35.       Block_Length: Block_Lengths := 1;
  36.       case Block_Type is
  37.         when Terminator =>
  38.           null;
  39.         when Voice_Data | Voice_Continuation =>
  40.           Sample_Rate: Sample_Rates;
  41.           case Packing is
  42.             when Unpacked =>
  43.               Unpacked_Sound: SB_Samples.Unpacked_Sounds(Block_Indices);
  44.             when Halved =>
  45.               Packed_Sound: SB_Samples.Packed_Sounds(Block_Indices);
  46.             when Thirds =>
  47.               Packed3_Sound: SB_Samples.Packed3_Sounds(Block_Indices);
  48.             when Quartered =>
  49.               Packed4_Sound: SB_Samples.Packed4_Sounds(Block_Indices);
  50.           end case;
  51.         when Silence =>
  52.           Silence_Interval: Positive_Durations;
  53.         when Marker =>
  54.           Mark    : Markers;
  55.         when Text =>
  56.           Text_String: String(Block_Indices);
  57.         when Start_Repeat =>
  58.           Count   : Repeat_Counts;
  59.         when End_Repeat =>
  60.           null;
  61.       end case;
  62.     end record;
  63.  
  64. end Voc_Data;
  65.